package com.hadoop.mr.max;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import com.hadoop.mr.average.ScoreDriver;
import com.hadoop.mr.average.ScoreMapper;
import com.hadoop.mr.average.ScoreReducer;

public class MaxDriver {
	public static String NAME_NODE_URL = "hdfs://192.168.186.6:9000";
	public static void main(String[] args) throws Exception {
		Configuration conf=new Configuration();
		Job job=Job.getInstance(conf);
		
		job.setJarByClass(MaxDriver.class);
		job.setMapperClass(MaxMapper.class);
		job.setReducerClass(MaxReducer.class);
		
		job.setMapOutputKeyClass(Text.class);
		job.setMapOutputValueClass(IntWritable.class);
		
		job.setOutputKeyClass(Text.class);
		job.setOutputKeyClass(IntWritable.class);
		
		FileInputFormat.setInputPaths(job,new Path(NAME_NODE_URL + "/max"));
		FileOutputFormat.setOutputPath(job, new Path(NAME_NODE_URL + "/max/result"));
		
		job.waitForCompletion(true);
	}

}
